<%@page import="org.apache.commons.lang3.StringUtils"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="user-index-head.jsp"%> 
<%
	String str = (String)request.getAttribute("ret");
	if(!StringUtils.isEmpty(str)){
		out.print("<script>alert('"+str+"');</script>");
	}
%>
   <div class="content">
          <div class="cLineB">
              <h4 class="left">优惠券列表 ({iMicro:$count}) 条<span class="FAQ">你本月有 {iMicro:$group.activitynum} 次机会可免收活动创建费，已经使用了 {iMicro:$activitynum} 次机会!</span></h4>
                 
              <div class="clr"></div>
          </div>
          <div class="cLine">
            <div class="pageNavigator left">
  <a href='<%=path%>/user/lottery!add.do?lottery=LOTTERY_COUPON' title='新增优惠券' class='btnGrayS vm bigbtn'><img src="<%=path %>/images/img/activity-scratch-card.png" class="vm" />新增优惠券</a>
              
            </div>
          
            <div class="clr"></div>
          </div>
          <div class="msgWrap">
          <form method="post"  action="" id="info" >
          <input name="delall"  type="hidden" value="" />
           <input name="wxid"  type="hidden" value="" />
            <TABLE class="ListProduct" border="0" cellSpacing="0" cellPadding="0" width="100%">
              <THEAD>
                <TR>
<TH class="select">选择</TH>
<TH>优惠券名称</TH>
<TH>关键字</TH>
<TH>优惠券状态</TH>
<TH>总浏览数</TH>
<TH>开始时间/结束时间</TH>
<TH>状态</TH>
<TH>外链代码</TH>
<TH class="norightborder">操作</TH>
                </TR>
              </THEAD>
              <TBODY>
                <TR></TR>
                  <c:forEach items="${page.content}" var="vo">
                <TR>
                  <TD><input type="checkbox" name='del_id[]' value="${vo.id}" class="checkitem"></TD>
                  <TD>${vo.lottery.title}</TD>
                  <TD>${vo.keyword}</TD> 
				  <TD>${vo.lottery.allpeople}</TD>
                  <TD>${vo.lottery.click}</TD>                  
                  <TD>${vo.lottery.startDate}<br />
                  ${vo.lottery.endDate}</TD>
                  <TD>
                  <c:choose>
                  	<c:when test="${vo.lottery.status=='0'}">未开始</c:when>
                  	<c:when test="${vo.lottery.status=='1'}">已经开始</c:when>
                  	<c:when test="${vo.lottery.status=='2'}">已经结束</c:when>
                  </c:choose>
				 </TD>
                  <TD>优惠券:${vo.lottery.id}</TD>
                   <TD class="norightborder">
				   <a href="">SN码管理</a> 
				   <a href="<%=path%>/user/lottery!edit.do?id=${vo.id}&lottery=LOTTERY_COUPON">编辑</a>  
				   <c:choose>
				   	<c:when test="${vo.lottery.status=='0'}">
				   		<a href="<%=path%>/user/lottery!changeStatus.do?id=${vo.id}&lottery=LOTTERY_COUPON&status=1">
				   			开始
				   		</a>
				   	</c:when>
				   <c:when test="${vo.lottery.status=='1'}">
				   		<a href="<%=path%>/user/lottery!changeStatus.do?id=${vo.id}&lottery=LOTTERY_COUPON&status=2">
				   			结束
				   		</a>
				   	</c:when>
				   	 <c:when test="${vo.lottery.status=='2'}">
				   			已经结束
				   	</c:when>
				   </c:choose>
				   <a href="<%=path%>/user/lottery!delete.do?id=${vo.id}&lottery=LOTTERY_COUPON">删除</a></TD>
                </TR>
				</c:forEach>
              </TBODY>
            </TABLE>
           </form> 
           <script>
   function checkvotethis() {
var aa=document.getElementsByName('del_id[]');
var mnum = aa.length;
j=0;
for(i=0;i<mnum;i++){
if(aa[i].checked){
j++;
}
}
if(j>0) {
document.getElementById('info').submit();
} else {
alert('未选中任何文章或回复！')
}
}
   </script>
          </div>
          <div class="cLine">
            <div class="pageNavigator right">
                 <div class="pages"></div>
              </div>
            <div class="clr"></div>
          </div>
        </div>

        <div class="clr"></div>
      </div>
    </div>
  </div>
  <script>

function checkAll(form, name) {
for(var i = 0; i < form.elements.length; i++) {
var e = form.elements[i];
if(e.name.match(name)) {
e.checked = form.elements['chkall'].checked;
}
}
}</script>
  <!--底部-->
  	</div>
<include file="Public:footer"/>